package com.icangya.admin;

//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.icangya.DAO.IDomainDAO;
//import com.icangya.Utils.FormatUtil;
//import com.icangya.Utils.JSONUtils;
//import com.icangya.Utils.exportFile.CreateSimpleExcelToDisk;
//import com.icangya.Utils.exportFile.GoodOrder;
//import com.icangya.Value.StaticValue;
//import com.icangya.domain.*;
//import com.icangya.service.*;
//import com.icangya.wxpay.utils.MD5Utils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.fastjson.JSONObject;
import com.icangya.Utils.JSONUtils;
import com.icangya.domain.GoodsConvert;
import com.icangya.domain.GoodsConvertDetails;
import com.icangya.domain.UserWithdrawRecord;
import com.icangya.service.IGoodsService;
import com.icangya.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.io.File;
//import java.io.IOException;
//import java.security.NoSuchAlgorithmException;
//import java.sql.Timestamp;
//import java.text.ParseException;
//import java.text.SimpleDateFormat;
//import java.util.*;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;
//
//import static com.icangya.Value.StaticValue.ADMIN_USER_SESSION;


@CrossOrigin
@RestController
@RequestMapping(value = "/admin/adminFund")
public class AdminController {

//    @Autowired
//    private IDomainService iDomainService;
//    @Autowired
//    private IDomainDAO iDomainDAO;
//    @Autowired
//    private IAdminUserService iAdminUserService;
//    @Autowired
//    private IMoneyService iMoneyService;
//    @Autowired
//    private IFootUserService iFootUserService;
//
//    private Logger logger = LoggerFactory.getLogger(this.getClass());
//    @Autowired
//    private IRedWineGameService iRedWineGameService;



    @Autowired
    private IUserService iUserService;

    @Autowired
    private IGoodsService iGoodsService;
    /**
     * 查询所有用户申请提现的记录
     * @param startPage  页码
     * @return
     */
    @RequestMapping(value = "getAllUserWithdrawRecord",method = RequestMethod.POST)
    public JSONObject getAllUserWithdrawRecord(int startPage){

        if(startPage<1){
            return JSONUtils.getRoot(1, "参数有误", "");
        }
        try{
            List list=  iUserService.getUserWithdrawRecordAll(startPage);
            if(list.get(0) ==null){
                return JSONUtils.getRoot(1, "没有用户提现记录", "");
            }

            JSONObject jsonObject=new JSONObject();
            jsonObject.put("value",list.get(0));
            jsonObject.put("totalPage",list.get(1));
            jsonObject.put("inPage",list.get(2));
            return JSONUtils.getRoot(0,"success",jsonObject);

        }catch (NullPointerException e){
            return JSONUtils.getRoot(2, "请重新登录!", null);
        }

    }


    /**
     * 根据提现状态查询用户申请提现的记录
     * @param startPage  页码
     * @param status  提现状态
     * @return
     */
    @RequestMapping(value = "getUserWithdrawRecordByStatus",method = RequestMethod.POST)
    public JSONObject getUserWithdrawRecordByStatus(int status,int startPage){

        if(startPage<1 || !(status ==1 || status==0 || status==2)){
            return JSONUtils.getRoot(1, "参数有误", "");
        }
        try{
            List list=  iUserService.getUserWithdrawRecordByStatus(status,startPage);
            if(list.get(0) ==null){
                return JSONUtils.getRoot(1, "没有用户提现记录", "");
            }

            JSONObject jsonObject=new JSONObject();
            jsonObject.put("value",list.get(0));
            jsonObject.put("totalPage",list.get(1));
            jsonObject.put("inPage",list.get(2));
            return JSONUtils.getRoot(0,"success",jsonObject);

        }catch (NullPointerException e){
            return JSONUtils.getRoot(2, "请重新登录!", null);
        }

    }

    /**
     * 修改用户申请提现的记录
     * @param id  记录编号
     * @param status  提现状态
     * @return
     */
    @RequestMapping(value = "updateUserWithdrawByStatus",method = RequestMethod.POST)
    public JSONObject updateUserWithdrawByStatus(long id,int status){

        if(id < 0 || !(status ==1 || status==0 || status==2)){
            return JSONUtils.getRoot(1, "参数有误", "");
        }

        try{

            UserWithdrawRecord userWithdrawRecord=iUserService.getUserWithdrawRecord(id);
            if(userWithdrawRecord==null){
                return JSONUtils.getRoot(1, "数据异常，请稍后重试。。", "");
            }

            userWithdrawRecord.setStatus(status);
            Boolean bool= iUserService.updateUserWithdrawByStatus(userWithdrawRecord);

            if(bool){
                return JSONUtils.getRoot(0,"success","");
            }

            return JSONUtils.getRoot(1, "修改失败，请稍后重试。。", "");
        }catch (NullPointerException e){
            return JSONUtils.getRoot(2, "请重新登录!", null);
        }

    }

    /**
     * 添加兑换商品信息
     * @param shopName  商品名称
     * @param point   商品积分  商品单价
     * @param firstPostage  首件邮费
     * @param otherPostage  此后每件增加运费价格
     * @param remark  备注
     * @param intro 商品简介
     * @param status  是否上架，1：已上架，0：已下架
     * @param mainPic  商品主图
     * @param imgUrl  商品详情图集合
     * @return
     */
    @RequestMapping(value = "addGoodsConvert",method = RequestMethod.POST)
    public JSONObject addGoodsConvert(String shopName,int point,int firstPostage,int otherPostage,String remark,String intro,long status,String mainPic,
                                      @RequestParam(value = "imgUrl[]",required = true,defaultValue = "") String[] imgUrl){


        if( !(status ==1 || status==0 )){
            return JSONUtils.getRoot(1, "请选择该商品的上架状态", "");
        }

        if( point < 0 || firstPostage < 0 || otherPostage < 0 || "".equals(shopName) || shopName==null || remark==null || "".equals(remark)
                || "".equals(intro) || intro==null || "".equals(mainPic) || mainPic==null ){
            return JSONUtils.getRoot(1, "参数有误。。。", "");
        }
        try{

            GoodsConvert goodsConvert=new GoodsConvert();
            goodsConvert.setShopName(shopName);
            goodsConvert.setPoint(point);
            goodsConvert.setFirstPostage(firstPostage);
            goodsConvert.setOtherPostage(otherPostage);
            goodsConvert.setRemark(remark);
            goodsConvert.setIntro(intro);
            goodsConvert.setStatus(status);
            goodsConvert.setMainPic(mainPic);

            //添加兑换商品信息
            GoodsConvert convert=  iGoodsService.saveGoodsConvert(goodsConvert);

            if(convert!=null){
                //添加商品详情图
                GoodsConvertDetails goodsConvertDetails=new GoodsConvertDetails();
                goodsConvertDetails.setGoodsConvertId(convert.getId());
                for (int i=0;i<imgUrl.length;i++){
                    goodsConvertDetails.setImgUrl(imgUrl[i]);
                    iGoodsService.saveGoodsConvertDetails(goodsConvertDetails);

                }

                return JSONUtils.getRoot(0, "添加商品成功。。", "");
            }

            return JSONUtils.getRoot(1, "添加商品失败，请稍后重试。。", "");
        }catch (NullPointerException e){
            return JSONUtils.getRoot(2, "请重新登录!", null);
        }

    }

    /**
     * 修改兑换商品信息
     * @param id
     * @param status
     * @return
     */
    @RequestMapping(value = "updateGoodsConvert",method = RequestMethod.POST)
    public JSONObject updateGoodsConvert(long id,long status){

        if( !(status ==1 || status==0 )  || id < 0){
            return JSONUtils.getRoot(1, "参数有误。。", "");
        }

        try{
            GoodsConvert goodsConvert=iGoodsService.getGoodsConvertById(id);
            if(goodsConvert == null){
                return JSONUtils.getRoot(1, "数据为空。。", "");
            }

            //修改用户上架状态
            goodsConvert.setStatus(status);
            Boolean bool=   iGoodsService.updateGoodsConvert(goodsConvert);

            if(bool){
                return JSONUtils.getRoot(0, "修改商品信息成功。。", "");

            }
            return JSONUtils.getRoot(1, "添加商品失败，请稍后重试。。", "");

        }catch (NullPointerException e){

            return JSONUtils.getRoot(2, "请重新登录!", null);

        }

    }

    /**
     * 根据兑换商品id删除商品信息
     * @param id
     * @return
     */
    @RequestMapping(value = "deleteGoodsConvertById",method = RequestMethod.POST)
    public JSONObject deleteGoodsConvertById(long id){

        if( id < 0){
            return JSONUtils.getRoot(1, "参数有误。。", "");
        }

        try{
            GoodsConvert goodsConvert=iGoodsService.getGoodsConvertById(id);
            if(goodsConvert == null){
                return JSONUtils.getRoot(1, "数据为空。。", "");
            }

            iGoodsService.removeGoodsConvertById(goodsConvert);

            return JSONUtils.getRoot(0, "商品成功。。", "");

        }catch (NullPointerException e){

            return JSONUtils.getRoot(2, "请重新登录!", null);

        }

    }






//    /**
//     * 删除轮播图
//     * @param id
//     */
//    @RequestMapping(value = "/deleteCarouseById",method = RequestMethod.POST)
//    public JSONObject deleteCarouseById(long id) {
//
//        if (id<=0){
//            return JSONUtils.getRoot(-1,"faild","");
//        }
//
//        iRedWineGameService.deleteCarouseById(id);
//
//        return JSONUtils.getRoot(0,"success","");
//
//    }
//
//    /**
//     * 获取轮奸图
//     * @return
//     */
//    @RequestMapping(value = "/getCarouseList")
//    public JSONObject getCarouseList(HttpServletRequest request,HttpServletResponse response) throws IOException {
//
//        List<RwCarousePic> rwCarousePicList = iRedWineGameService.getCarouseList();
//
//        return JSONUtils.getRoot(0,"SUCCESS",rwCarousePicList);
//    }
//    /**
//     * 获取所有申请提现的用户以及银行卡信息
//     * @return
//     */
//    @RequestMapping(value = "/selectAllNeedPayInfo")
//    public JSONObject selectAllNeedPayInfo(HttpServletRequest request,HttpServletResponse response){
//
//        List<RwUserBank> rwUserBankList =  iRedWineGameService.selectAllNeedPayInfo();
//
//        return JSONUtils.getRoot(0,"success",rwUserBankList);
//
//    }
//
//    /**
//     * 修改提现记录是否已支付状态
//     * @return
//     */
//    @RequestMapping(value = "/updateStatusWithStatu",method = RequestMethod.POST)
//    public JSONObject updatePayWithStatu(long id,HttpServletRequest request,HttpServletResponse response){
//
//
//        int status = 0;
//        boolean flag = false;
//        RwUserBank rwUserBank =  iRedWineGameService.getUserBankById(id);
//        if (rwUserBank.getStatus()==status){
//            status = 1;
//            rwUserBank.setStatus(status);
//            flag = iRedWineGameService.updateUserBank(rwUserBank);
//        }
//
//        if (flag==true){
//            return JSONUtils.getRoot(0,"success","");
//        }
//
//        return JSONUtils.getRoot(1,"不可以修改为非支付状态","");
//
//    }
//
//
//
//    /**
//     * 获取商品信息（熊猫商城只有一条商品）
//     * @return
//     */
//    @RequestMapping(value = "/getShopInfo")
//    public JSONObject getShopInfo(HttpServletRequest request,HttpServletResponse response){
//
//        Rwshop rwshop = iRedWineGameService.getRwshop("1");
//        if (rwshop==null){
//            return JSONUtils.getRoot(-1,"获取已上架商品记录为空，请联系管理员。",rwshop);
//        }
//
//        List<RwshopPic> rwshopPicList = iRedWineGameService.getRwshopPicListByShopId(rwshop.getId());
//
//        JSONObject shopJson = new JSONObject();
//
//        shopJson.put("rwshop",rwshop);
//        shopJson.put("rwshopPicList",rwshopPicList);
//
//        return JSONUtils.getRoot(0,"succsss",shopJson);
//
//    }
//
//    /**
//     * 修改商品上架状态
//     * @return
//     */
//    @RequestMapping(value = "/changeShopStatus")
//    public JSONObject changeShopStatus(long shopid,int status,HttpServletRequest request,HttpServletResponse response){
//
//        iRedWineGameService.setRwshopToState(shopid,status);
//
//        return JSONUtils.getRoot(0,"succsss","");
//
//    }
//
//    /**
//     * 修改主页大图
//     * @return
//     */
//    @RequestMapping(value = "/updateShopBigPic",method = RequestMethod.POST)
//    public JSONObject updateShopBigPic(String pigPic,HttpServletRequest request,HttpServletResponse response){
//
//
//        Rwshop rwshop = iRedWineGameService.getRwshop("1");
//        if (rwshop==null){
//            return JSONUtils.getRoot(-1,"获取已上架商品记录为空，请联系管理员。",rwshop);
//        }
//        rwshop.setBigPic(pigPic);
//
//        iRedWineGameService.updateRwshop(rwshop);
//
//        return JSONUtils.getRoot(0,"succsss","");
//
//    }
//
//
//    /**
//     * 添加商品
//     * @return
//     */
//    @RequestMapping(value = "/insertShop",method = RequestMethod.POST)
//    public JSONObject insertShop(String intro,long numPiecs,String remark,int price,String shopName,String bigPic,String mainPic,int status,int salesNum,int addNumToSales,int oldPrice,int expressFee,String infoPic, HttpServletRequest request,HttpServletResponse response){
//
//        logger.info("intro="+intro+",numPiecs="+numPiecs+",price="+price+",shopName="+shopName+",bigPic="+bigPic);
//        if (intro==null||numPiecs<=0||price<=0||shopName==null||bigPic==null){
//            return JSONUtils.getRoot(-1,"参数不能为空，也不能为0",null);
//        }
//
//        if (status < 0 || status > 1){
//            return JSONUtils.getRoot(-2,"status参数错误",null);
//        }
//
//        Rwshop rwshop = new Rwshop();
//        rwshop.setStatus(String.valueOf(status));
//        rwshop.setCreateTime(new Timestamp(new Date().getTime()));
//        rwshop.setIntro(intro);
//        rwshop.setNumPiece(numPiecs);
//        rwshop.setRemark(remark);
//        rwshop.setPrice(price);
//        rwshop.setShopName(shopName);
//        rwshop.setBigPic(bigPic);
//        rwshop.setMainPic(mainPic);
//        rwshop.setOldPrice(oldPrice);
//        rwshop.setExpressFee(expressFee);
//        rwshop.setStatus(1+"");
//
//        //添加商品
//        RwshopPic rwshopPic = new RwshopPic();
//        rwshopPic.setCreateTime(new Timestamp(new Date().getTime()));
//        rwshopPic.setPicPath(infoPic);
//        rwshopPic.setShopId(rwshop.getId());
//        rwshopPic.setRemark("--");
//
//        long shopid = iAdminUserService.insertShop(rwshop);
//        long spid = iRedWineGameService.saveShopInfoPic(rwshopPic);
//
//        if (spid>0&&shopid>0){
//
//            return JSONUtils.getRoot(0,"succsss","");
//
//        }
//        return JSONUtils.getRoot(-1,"faild","");
//
//
//    }
//
//    /**
//     * 更新商品
//     * @return
//     */
//    @RequestMapping(value = "/updateShop",method = RequestMethod.POST)
//    public JSONObject updateShop(long id,String intro,long numPiecs,String remark,int price,String shopName,String bigPic,String mainPic,int status,int oldPrice,int expressFee,String infoPic,HttpServletRequest request,HttpServletResponse response){
//
//        logger.info("intro="+intro+",numPiecs="+numPiecs+",price="+price+",shopName="+shopName+",bigPic="+bigPic);
//
//        if (intro==null||numPiecs<=0||price<=0||shopName==null){
//
//            return JSONUtils.getRoot(-1,"参数不能为空，也不能为0",null);
//
//        }
//
//        if (status < 0 || status > 1){
//            return JSONUtils.getRoot(-2,"status参数错误",null);
//        }
//
//        Rwshop rwshop = iRedWineGameService.getRwshopById(id);
//        rwshop.setStatus(String.valueOf(status));
//        rwshop.setCreateTime(new Timestamp(new Date().getTime()));
//        rwshop.setIntro(intro);
//        rwshop.setNumPiece(numPiecs);
//        rwshop.setRemark(remark);
//        rwshop.setPrice(price);
//        rwshop.setShopName(shopName);
//        rwshop.setBigPic(bigPic);
//        rwshop.setMainPic(mainPic);
//        rwshop.setOldPrice(oldPrice);
//        rwshop.setExpressFee(expressFee);
//        rwshop.setStatus(1+"");
//
//        //添加商品
//        RwshopPic rwshopPic = iRedWineGameService.getRwshopPicListByShopId(rwshop.getId()).get(0);
//        rwshopPic.setCreateTime(new Timestamp(new Date().getTime()));
//        rwshopPic.setPicPath(infoPic);
//        rwshopPic.setShopId(rwshop.getId());
//        rwshopPic.setRemark("--");
//
////        long shopid = iAdminUserService.insertShop(rwshop);
//        boolean flag = iAdminUserService.updateShop(rwshop);
//        long spid = iRedWineGameService.saveShopInfoPic(rwshopPic);
//
//        if (spid>0 && flag){
//
//            return JSONUtils.getRoot(0,"succsss","");
//
//        }
//        return JSONUtils.getRoot(-1,"faild","");
//
//    }
//
//    /**
//     * 获取用户信息，根据userid
//     * @param request
//     * @param response
//     * @param userid
//     * @return
//     * @throws IOException
//     */
//    @RequestMapping(value = "getUserById")
//    public JSONObject getUserById(HttpServletRequest request, HttpServletResponse response,long userid) throws IOException {
//
//        if (userid<=0){
//            return  JSONUtils.getRoot(-1,"参数异常",null);
//        }
//        User user = iFootUserService.getUserByUid(userid);
//        JSONObject jsonObject = new JSONObject();
//        jsonObject.put("id",user.getId());
//        jsonObject.put("openid",user.getOpenId());
//        jsonObject.put("nickName",user.getNickName());
//        jsonObject.put("userHeadImg",user.getHeadImgUrl());
//        jsonObject.put("createTime",user.getCreateTime());
//        jsonObject.put("myMoney",0);//账户余额
//        jsonObject.put("myGet",iRedWineGameService.getCommissionByUserid(user.getId()).getMoney());//收益
//        jsonObject.put("sharesNum",iRedWineGameService.getSharesSum(user.getId()).getSharesNum());//股权
//        jsonObject.put("parentId",user.getParentId());//推荐人
//        jsonObject.put("userLever",iRedWineGameService.getVipUserByuserid(user.getId())==null?"非会员":"会员");//是否会员
//
//        return  JSONUtils.getRoot(0,"success",jsonObject);
//
//
//    }
//
//    /**
//     * 获取所有用户，按页码
//     * @param request
//     * @param response
//     * @param startPage
//     * @return
//     * @throws IOException
//     */
//    @RequestMapping(value = "getUserList",method = RequestMethod.POST)
//    public JSONObject getUserList(HttpServletRequest request, HttpServletResponse response,int startPage) throws IOException {
//
//        List  list = iAdminUserService.getUserList(startPage);
//
//        List<User> userList= (List<User>) list.get(0);
//        JSONArray jsonArray = new JSONArray();
//
//        for(Object[] obj:(List<Object[]>) list.get(0)) {
//            JSONObject jsonObject = new JSONObject();
//            jsonObject.put("id", obj[0]);
//            jsonObject.put("openid", obj[1]);
//            jsonObject.put("nickName", obj[2]);
//            jsonObject.put("userHeadImg", obj[3]);
//            jsonObject.put("createTime", obj[4]);
//
////        }
////        for (int i =0 ;i<userList.size();i++){
////            JSONObject jsonObject = new JSONObject();
////            User user = userList.get(i);
////            jsonObject.put("id",user.getId());
////            jsonObject.put("openid",user.getOpenId());
////            jsonObject.put("nickName",user.getNickName());
////            jsonObject.put("userHeadImg",user.getHeadImgUrl());
////            jsonObject.put("createTime",user.getCreateTime());
//            jsonObject.put("myMoney",0);//账户余额
//            jsonObject.put("myGet",iRedWineGameService.getCommissionByUserid((Long) obj[0]).getMoney());//收益
//            jsonObject.put("sharesNum",iRedWineGameService.getSharesSum((Long) obj[0]).getSharesNum());//股权
//            jsonObject.put("parentId",obj[5]);//推荐人
//            jsonObject.put("userLever",iRedWineGameService.getVipUserByuserid((Long) obj[0])==null?"非会员":"会员");//是否会员
//
//            jsonArray.add(jsonObject);
//        }
//
//        JSONObject jsonObject=new JSONObject();
//        jsonObject.put("value",jsonArray);
//        jsonObject.put("totalPage",list.get(1));
//        jsonObject.put("inPage",list.get(2));
//        return  JSONUtils.getRoot(0,"success",jsonObject);
//
//
//    }
//
//    /**
//     * 获取所有订单
//     * @param request
//     * @param response
//     * @return
//     * @throws IOException
//     */
//    @RequestMapping(value = "getOrderList")
//    public JSONObject getOrderList(HttpServletRequest request, HttpServletResponse response) throws IOException {
//
//        List<RwGoodOrder> rwGoodOrders = iRedWineGameService.getRwGoodOrders();
//
//        return  JSONUtils.getRoot(0,"success",rwGoodOrders);
//
//    }
//
//
//    /**
//     * 修改一个订单的快递号和快递公司
//     * @param id
//     * @param expressNum
//     * @param expressComp
//     * @param request
//     * @param response
//     * @return
//     * @throws IOException
//     */
//    @RequestMapping(value = "updateOrderWithExpressNumAndExpressComp",method = RequestMethod.POST)
//    public JSONObject updateOrderWithExpressNumAndExpressComp(long id,String expressNum,String expressComp,HttpServletRequest request, HttpServletResponse response) throws IOException {
//
//        RwGoodOrder rwGoodOrders = iRedWineGameService.getRwGoodOrderById(id);
//
//        rwGoodOrders.setExpressNum(expressNum);
//        rwGoodOrders.setExpressComp(expressComp);
//        rwGoodOrders.setSendStatus(1);
//
//        boolean flag = iRedWineGameService.updateGoodOrder(rwGoodOrders);
//        if (flag){
//            return  JSONUtils.getRoot(0,"success","");
//        }else{
//            return  JSONUtils.getRoot(-1,"faild","");
//        }
//
//    }
//
//
//    /**
//     * 根据支付和发货状态获取订单列表
//     * @param payStatus
//     * @param sendStatus
//     * @param request
//     * @param response
//     * @return
//     * @throws IOException
//     */
//    @RequestMapping(value = "getOrdersByPayStataAndSendStatus",method = RequestMethod.POST)
//    public JSONObject getOrderListByPayStataAndSendStatus(int payStatus,int sendStatus,HttpServletRequest request, HttpServletResponse response) throws IOException {
//
//        if (payStatus>1||payStatus<0||sendStatus>1||sendStatus<0){
//            return  JSONUtils.getRoot(-1,"参数错误","");
//        }
//
//        List<RwGoodOrder> rwGoodOrders = iRedWineGameService.getOrderListByPayStataAndSendStatus(payStatus,sendStatus);
////        List<RwGoodOrder> rwGoodOrders = iRedWineGameService.getRwGoodOrders();
//
//        return  JSONUtils.getRoot(0,"success",rwGoodOrders);
//
//    }
//
//    /**
//     * 根据支付和发货状态获取订单列表，然后导出excel表格
//     * @param payStatus
//     * @param sendStatus
//     * @param request
//     * @param response
//     * @return
//     * @throws IOException
//     */
//    @RequestMapping(value = "getOrdersByPayStataAndSendStatusToExportExcel",method = RequestMethod.POST)
//    public JSONObject getOrdersByPayStataAndSendStatusToExportExcel(int payStatus,int sendStatus,HttpServletRequest request, HttpServletResponse response) throws IOException {
//
//        try {
//            Thread.sleep(1000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        if (payStatus>1||payStatus<0||sendStatus>1||sendStatus<0){
//            return  JSONUtils.getRoot(-1,"参数错误","");
//        }
//
//        List<RwGoodOrder> rwGoodOrders = iRedWineGameService.getOrderListByPayStataAndSendStatus(payStatus,sendStatus);
////        List<RwGoodOrder> rwGoodOrders = iRedWineGameService.getRwGoodOrders();
//
//        List<GoodOrder> goodOrders = new ArrayList<GoodOrder>();
//        for (RwGoodOrder rwGoodOrder : rwGoodOrders){
//            GoodOrder goodOrder = new GoodOrder();
//            goodOrder.setAddressId(rwGoodOrder.getAddressId());
//            goodOrder.setCreateTime(rwGoodOrder.getCreateTime());
//            goodOrder.setExpressComp(rwGoodOrder.getExpressComp());
//            goodOrder.setExpressNum(rwGoodOrder.getExpressNum());
//            goodOrder.setId(rwGoodOrder.getId());
//            goodOrder.setIntro(rwGoodOrder.getIntro());
//            goodOrder.setMainPic(rwGoodOrder.getMainPic());
//            goodOrder.setMobilePhone(rwGoodOrder.getMobilePhone());
//            goodOrder.setNumPiece(rwGoodOrder.getNumPiece());
//            goodOrder.setOpenid(rwGoodOrder.getOpenid());
//            goodOrder.setOrderAddress(rwGoodOrder.getOrderAddress());
//            goodOrder.setOrderId(rwGoodOrder.getOrderId());
//            goodOrder.setOrderUserImg(rwGoodOrder.getOrderUserImg());
//            goodOrder.setOrderUserNickName(rwGoodOrder.getOrderUserNickName());
//            goodOrder.setPaystatus(rwGoodOrder.getPaystatus()==0?"未付款":"已付款");
//            goodOrder.setPrice(rwGoodOrder.getPrice());
//            goodOrder.setRemark(rwGoodOrder.getRemark());
//            goodOrder.setSendStatus(rwGoodOrder.getSendStatus()==0?"未发货":"已发货");
//            goodOrder.setSumPices(rwGoodOrder.getSumPices());
//            goodOrder.setUserid(rwGoodOrder.getUserid());
//            goodOrders.add(goodOrder);
//        }
//
//        try {
//            String excelPath = CreateSimpleExcelToDisk.exportExcel(goodOrders);
//            if (excelPath!=null){
//                JSONObject jsonObject = new JSONObject();
//                jsonObject.put("excelPath",excelPath);
//                return   JSONUtils.getRoot(0,"success",jsonObject);
//            }
//            return   JSONUtils.getRoot(-2,"文件写入失败","");
//        } catch (Exception e) {
////            e.printStackTrace();
//            return  JSONUtils.getRoot(-1,e.getMessage(),"");
//        }
//
//    }
//
//    // 添加轮播图
////    @RequestMapping(value = "setCarouselFigure")
//    public JSONObject setCarouselFigure(HttpServletRequest request, HttpServletResponse response, MultipartFile file, @RequestParam String imgContent) throws IOException {
//        if(imgContent.equals(null)){
//            imgContent="广州心上人科技有限公司";
//        }
//
//        //上传的目录地址
//        String uploadDir= request.getSession().getServletContext().getRealPath("/")+"carouse/";
//        //如果目录不存在，自动创建文件夹
//        File dir=new File(uploadDir);
//        if(!dir.exists()){
//            dir.mkdir();
//        }
//        String suffix=file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
//
//        //上传文件名
//        String filename= UUID.randomUUID()+suffix;
//
//        //服务器端保存的文件对象
//        File serverFile=new File(uploadDir+filename);
//        //将上传的文件写入到服务器端文件内
//        try {
//            file.transferTo(serverFile);
//        } catch (IOException e) {
//            e.printStackTrace();//上传失败
//            return JSONUtils.getRoot(1,"fail","上传失败");
//        }
//
////        CarouselFigure carouselFigure=  iAdminUserService.setCarouselFigure(new CarouselFigure("carouse/"+filename,imgContent));
//
//        return null;
//    }
//
//    /**
//     * 上传轮播图
//     * @param request
//     * @param response
//     * @param file
//     * @return 返回图片路径
//     * @throws IOException
//     */
//    @RequestMapping(value = "addCarouse" ,method = RequestMethod.POST)
//    public void addCarouse(HttpServletRequest request, HttpServletResponse response, @RequestParam("file") MultipartFile file) throws IOException {
//
//        logger.info(file.getBytes().length+"==bytes=");
//        //上传的目录地址
//        String uploadDir= request.getSession().getServletContext().getRealPath("/")+"upload/shop/carouse/";
//        //如果目录不存在，自动创建文件夹
//        File dir=new File(uploadDir);
//        if(!dir.exists()){
//            dir.mkdir();
//        }
//        String suffix=file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
//
//        //上传文件名
//        String filename= UUID.randomUUID()+suffix;
//
//        //服务器端保存的文件对象
//        File serverFile=new File(uploadDir+filename);
//        //将上传的文件写入到服务器端文件内
//        try {
//            file.transferTo(serverFile);
//             JSONUtils.getRoot(0,"success","upload/shop/carouse/"+filename);
//            request.getSession().setAttribute("carPic","upload/shop/carouse/"+filename);
//        } catch (IOException e) {
////            e.printStackTrace();//上传失败
//             JSONUtils.getRoot(-1,e.getMessage(),"");
//            request.getSession().setAttribute("carPic","");
//        }
//    }
//
//    /**
//     * 添加轮播图记录
//     * @param request
//     * @param response
//     * @param carousePic
//     * @return 返回图片路径
//     * @throws IOException
//     */
//    @RequestMapping(value = "saveCarouse" ,method = RequestMethod.POST)
//    public JSONObject saveCarouse(@RequestParam(value = "carousePic[]",required = true,defaultValue = "") String[] carousePic,HttpServletRequest request, HttpServletResponse response) throws IOException {
//
//        logger.info(String.valueOf(carousePic.length));
//        Rwshop rwshop = iRedWineGameService.getRwshop("1");
//        for (int i=0;i<carousePic.length;i++){
//            RwCarousePic rwCarousePic = new RwCarousePic();
//            rwCarousePic.setPicPath(carousePic[i]);
//            rwCarousePic.setShopId(rwshop.getId());
//            long cid = iRedWineGameService.addCarouse(rwCarousePic);
//        }
//
//        return JSONUtils.getRoot(0,"success","");
//
//    }
//
//    /**
//     * 查询轮播图片
//     * @param request
//     * @param response
//     * @return 返回图片路径
//     * @throws IOException
//     */
//    @RequestMapping(value = "selectCarouse", method = RequestMethod.GET)
//    public JSONObject selectCarouse(HttpServletRequest request,HttpServletResponse response) throws IOException {
//
//        String resUrl = String.valueOf(request.getSession().getAttribute("carPic"));
////        request.getSession().removeAttribute("infoPic");
//        return JSONUtils.getRoot(0,"success", resUrl);
//
//    }
//
//    /**
//     * 添加商品图片
//     * @param request
//     * @param response
//     * @param file
//     * @return 返回图片路径
//     * @throws IOException
//     */
//    @RequestMapping(value = "addShopPic", method = RequestMethod.POST)
//    public void addShopPic(HttpServletRequest request,HttpServletResponse response,@RequestParam(value = "file") MultipartFile file) throws IOException {
//
//        //上传的目录地址
//        String uploadDir= request.getSession().getServletContext().getRealPath("/")+"upload/shop/images/";
//        //如果目录不存在，自动创建文件夹
//        File dir=new File(uploadDir);
//        if(!dir.exists()){
//            dir.mkdir();
//        }
//        String suffix=file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
//
//        //上传文件名
//        String filename= UUID.randomUUID()+suffix;
//
//        //服务器端保存的文件对象
//        File serverFile=new File(uploadDir+filename);
//        //将上传的文件写入到服务器端文件内
//        try {
//            file.transferTo(serverFile);
//             JSONUtils.getRoot(0,"success","upload/shop/images/"+filename);
//             request.getSession().setAttribute("infoPic","upload/shop/images/"+filename);
//        } catch (IOException e) {
//            e.printStackTrace();//上传失败
//             JSONUtils.getRoot(-1,e.getMessage(),"");
//            request.getSession().setAttribute("infoPic","");
//        }
//    }
//
//    /**
//     * 查询商品图片
//     * @param request
//     * @param response
//     * @return 返回图片路径
//     * @throws IOException
//     */
//    @RequestMapping(value = "selectShopPic", method = RequestMethod.GET)
//    public JSONObject selectShopPic(HttpServletRequest request,HttpServletResponse response) throws IOException {
//
//        String resUrl = String.valueOf(request.getSession().getAttribute("infoPic"));
////        request.getSession().removeAttribute("infoPic");
//        return JSONUtils.getRoot(0,"success", resUrl);
//
//    }
//
//
//    /**
//     * 得到充值总额，提现总额，未提现总额
//     * @param request
//     * @return
//     */
//    @RequestMapping(value = "/getAllInfo")
//    public JSONObject getAllInfo(HttpServletRequest request) {
//
//        return JSONUtils.getRoot(0,"success",iAdminUserService.getAllInfo());
//
//    }
//
//
//    /**
//     * 添加客服图片
//     * @param picPath
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/updateRwVailabelWithPic",method = RequestMethod.POST)
//    public JSONObject updateRwVailabelWithPic(String picPath,HttpServletRequest request,HttpServletResponse response) {
//
//        RwVariable rwVariable = iRedWineGameService.getRwVariableById(1l);
//
//        rwVariable.setCoutomerPic(picPath);
//
//        boolean flag = iRedWineGameService.updateRwVariable(rwVariable);
//
//        if (flag)
//            return JSONUtils.getRoot(0,"添加成功","");
//        else
//            return JSONUtils.getRoot(-1,"添加失败","");
//    }
//
//    /**
//     * 获取客服图片
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getCustomerPic",method = RequestMethod.GET)
//    public JSONObject getCustomerPic(HttpServletRequest request,HttpServletResponse response) {
//
//        RwVariable rwVariable = iRedWineGameService.getRwVariableById(1l);
//
//        return JSONUtils.getRoot(0,"success",rwVariable);
//    }
//
//    /**
//     * 更新营业额，股份分红比，直推一级奖励，二级奖励
//     * @param turnover
//     * @param shares
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/updateTurAndShares",method = RequestMethod.POST)
//    public JSONObject updateTurAndShares(Double turnover,Double shares,int firstM,int secondM,int allAmount,HttpServletRequest request,HttpServletResponse response) {
//
//        RwVariable rwVariable = iRedWineGameService.getRwVariableById(1l);
//
//        rwVariable.setShares(shares);
//        rwVariable.setTurnover(turnover);
//        rwVariable.setFirstM(firstM);
//        rwVariable.setSecondM(secondM);
//        rwVariable.setAllAmount(allAmount);
//
//        boolean flag = iRedWineGameService.updateRwVariable(rwVariable);
//
//        if (flag)
//            return JSONUtils.getRoot(0,"成功","");
//        else
//            return JSONUtils.getRoot(-1,"失败","");
//
//    }
//
//    /**
//     * 获取用户总数，获取会员总数，获取股东人数，获取平台总收入
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getInfoOfUserVipSharerInMoneyCount")
//    public JSONObject getInfoOfUserVipSharerInMoneyCount(HttpServletRequest request,HttpServletResponse response) {
//
//        RwVariable rwVariable = iRedWineGameService.getRwVariableById(1l);
//        JSONObject jsonObject = new JSONObject();
//        jsonObject.put("userCount",iFootUserService.getAllUser().size());//用户总数
//        jsonObject.put("vipCount",iRedWineGameService.getVipUser().size());//会员总数
//        jsonObject.put("sharerCount",iRedWineGameService.getHaveSharesUser().size());//股东人数
//        jsonObject.put("firstM",rwVariable.getFirstM());//直推一级奖励
//        jsonObject.put("secondM",rwVariable.getSecondM());//二级奖励
//        jsonObject.put("sharesP",rwVariable.getShares());//股份分红比
//        jsonObject.put("turnover",rwVariable.getTurnover());//营业额分红比
//        jsonObject.put("xujia_uuu",rwVariable.getAllAmount());//虚假平台当日收入
//
//        int real_uuu = 0;//真实平台当日收入
//        int inM = 0;//平台总收入
//        //计算平台收入
//        List<FbPayInfo> fbPayInfos = iRedWineGameService.getPayInfolist();
//        for (int i =0; i < fbPayInfos.size();i++){
//            if (fbPayInfos.get(i).getPayDate().toString().indexOf(FormatUtil.getDateyyyy_MM_dd())>0){
//                real_uuu = real_uuu + Integer.parseInt(fbPayInfos.get(i).getTotal_fee());//平台当日收入累计，金额单位是分？还是元？，
//            }
//            inM = inM +  Integer.parseInt(fbPayInfos.get(i).getTotal_fee());//平台总收入累计，金额单位是分？还是元？，
//        }
//        jsonObject.put("inMoney",inM);
//        jsonObject.put("real_uuu",real_uuu);
//
//        return JSONUtils.getRoot(0,"成功",jsonObject);
//
//    }
//
//
//    /**
//     * 查询所有域名记录
//     * @return
//     */
//    @RequestMapping(value = "/selectDomains")
//    public JSONObject selectDomains() {
//        List<DomainDO> domainList = null;
//        try {
//            domainList = iDomainService.selectDomains();
//        } catch (Exception e) {
//            return JSONUtils.getRoot(0,"fail",e.getMessage());
//        }
//        JSONObject jsonObject = null;
//        JSONArray jsonArray = new JSONArray();
//        for (DomainDO domainDO : domainList){
//            jsonObject = new JSONObject();
//            jsonObject.put("id",domainDO.getId());
//            jsonObject.put("domainUrl",domainDO.getDomainUrl());
//            jsonObject.put("isavailable",domainDO.getIsavailable());
//            jsonArray.add(jsonObject);
//            jsonObject = null;
//
//        }
//        return JSONUtils.getRoot(0,"success",jsonArray);
//    }
//
//    /**
//     *
//     * 获取启用的域名
//     * @return
//     */
//    @RequestMapping(value = "/getDomain")
//    public JSONObject getDomain() {
//        List<DomainDO> domainlist = null;
//        try {
//            domainlist = iDomainService.getDoamin();
//        } catch (Exception e) {
//            return JSONUtils.getRoot(0,"fail",e.getMessage());
//        }
//        JSONObject jsonObject = new JSONObject();
//        jsonObject.put("id",domainlist.get(0).getId());
//        jsonObject.put("DomainUrl",domainlist.get(0).getDomainUrl());
//        jsonObject.put("isavailable",domainlist.get(0).getIsavailable());
//        return JSONUtils.getRoot(0,"success",jsonObject);
//    }
//
//    /**
//     * 添加域名
//     * @param domainUrl
//     * @return
//     */
//    @RequestMapping(value = "/insertDomain",method = RequestMethod.POST)
//    public JSONObject insertDomain(@RequestParam String domainUrl) {
//
//        if(domainUrl.indexOf(" ")!=-1){
//            return JSONUtils.getRoot(1,"fail","存在非法字符!(不允许空格)");
//        }
//        if(domainUrl==null || "".equals(domainUrl)){
//            return JSONUtils.getRoot(1,"fail","域名不能为空！");
//        }
//
//        DomainDO domainDO = new DomainDO();
//        domainDO.setDomainUrl(domainUrl);
//        domainDO.setIsavailable("0");
//
//        try {
//            iDomainService.saveDomain(domainDO);
//            return JSONUtils.getRoot(0,"success","");
//        } catch (Exception e) {
//            return JSONUtils.getRoot(-1,"faild",e.getMessage());
//        }
//
//    }
//
//    /**
//     * 更新域名
//     * @param id
//     * @param isavailable
//     * @return
//     */
//    @RequestMapping(value = "/updateDomain",method = RequestMethod.POST)
//    public JSONObject updateDomain(@RequestParam Long id ,@RequestParam String isavailable) {
//
//        if ("0".equals(isavailable) || "1".equals(isavailable) || "2".equals(isavailable)){
//            DomainDO domainDO = iDomainDAO.get(id);
//            domainDO.setIsavailable(isavailable);
//            try {
//                iDomainService.updateDoamin(domainDO);
//                return JSONUtils.getRoot(0,"success","1");
//            } catch (Exception e) {
//                return JSONUtils.getRoot(1,"fail",e.getMessage());
//            }
//        }else{
//            return JSONUtils.getRoot(1,"fail","参数异常！");
//        }
//
//    }
//
//    /**
//     * 用户退出
//     * @param session
//     * @return
//     */
//    @RequestMapping(value = "exitLogin")
//    public JSONObject  exitLogin(HttpSession session){
//
//        // 销毁session
//        session.removeAttribute(ADMIN_USER_SESSION);
//        return JSONUtils.getRoot(0,"success",null);
//    }
//
//    /**
//     * //后台登录
//     * @param name
//     * @param passWord
//     * @param session
//     * @return
//     */
//    @RequestMapping(value = "login",method = RequestMethod.POST)
//    public JSONObject login(@RequestParam String name, @RequestParam String passWord, HttpSession session){
//
//        //正则匹配密码为4-10位的数字（管理员）
//        Pattern p = Pattern.compile("(\\d{4,10})");
//        Matcher m = p.matcher(name);
//
//        //正则匹配密码为6-12位的数字和字母（管理员）
//        Pattern p1 = Pattern.compile("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$");
//        Matcher m1 = p1.matcher(passWord);
//
//        logger.info("前端传进来的密码："+passWord);
//
//        if (m.matches() && m1.matches()) {
//            //密码加密(规则：密码+proxy_key，使用md5加一次密)
////            passWord = MD5Util.toMD5(passWord + StaticValue.PROXY_KEY).toUpperCase();
//            try {
//                passWord = MD5Utils.getMD5Upper(passWord + StaticValue.REGISTER_KEY);
//            } catch (NoSuchAlgorithmException e) {
//                e.printStackTrace();
//            }
//            JSONObject jsonObject=new JSONObject();
//            Admin admin=iAdminUserService.login(name,passWord,session);
//
//            if(admin==null){
//                //不存在该用户
//                return JSONUtils.getRoot(1,"fail","不存在该用户");
//            }else{
//                if(passWord.equals(admin.getPassWord())){
//                    /*登录成功,将用户写入session中*/
//                    session.setAttribute(ADMIN_USER_SESSION,admin);
//                    return  JSONUtils.getRoot(0,"success",jsonObject);
//                }else{
//                    //密码不正确
//                    return JSONUtils.getRoot(1,"fail","密码不正确");
//                }
//            }
//
//        }else{
////            1，密码不能全部是数字
////            2，密码不能全部是字母
////            3，密码必须是数字或字母
//            return JSONUtils.getRoot(1,"fail","账号或密码长度不符合，账号的长度是4-10的数字，密码的长度为6-12位的数字加字母");
//        }
//
//    }
//
//    /**
//     *  //获取登录后用户信息
//     * @param session
//     * @return
//     */
//    @RequestMapping(value = "loginIndex")
//    public JSONObject loginIndex(HttpSession session){
//        Admin admin= (Admin) session.getAttribute(ADMIN_USER_SESSION);//获取登录后台的用户信息
//        if(admin==null)
//            return JSONUtils.getRoot(1,"fail","用户不能为空");
//        return JSONUtils.getRoot(0,"success",admin.getUserName());
////        return JSONUtils.getRoot(0,"success",admin);
//    }
//
//    /**
//     * //修改密码
//     * @param password
//     * @param passWord2
//     * @param session
//     * @return
//     */
//    @RequestMapping(value = "setAccountName",method = RequestMethod.POST)
//    public JSONObject setAccountName(@RequestParam String password,@RequestParam String passWord2,HttpSession session){
//
//        if(passWord2=="" || password =="")
//            return JSONUtils.getRoot(1,"fail","参数不能为空");
//
//        //正则匹配密码为6-12位的数字和字母
//        Pattern p1 = Pattern.compile("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$");
//        Matcher m1 = p1.matcher(passWord2);
//        Matcher m = p1.matcher(password);
//
//        if (m.matches()) {
//            //密码加密(规则：密码+proxy_key，使用md5加一次密)
//            try {
//                password = MD5Utils.getMD5Upper(password + StaticValue.REGISTER_KEY);
//            } catch (NoSuchAlgorithmException e) {
//                e.printStackTrace();
//            }
//        }else{
////            1，密码不能全部是数字
////            2，密码不能全部是字母
////            3，密码必须是数字或字母
//            return JSONUtils.getRoot(1,"fail","旧密码长度不符合 ，密码的长度为6-12位的数字加字母");
//        }
//
//        if (m1.matches()) {
//            //密码加密(规则：密码+proxy_key，使用md5加一次密)
//            try {
//                passWord2 = MD5Utils.getMD5Upper(passWord2 + StaticValue.REGISTER_KEY);
//            } catch (NoSuchAlgorithmException e) {
//                e.printStackTrace();
//            }
//        }else{
////            1，密码不能全部是数字
////            2，密码不能全部是字母
////            3，密码必须是数字或字母
//            return JSONUtils.getRoot(1,"fail","新密码长度不符合 ，密码的长度为6-12位的数字加字母");
//        }
////        Admin admin=  iAdminDAO.getAdminById(1); //测试
//        Admin admin= (Admin) session.getAttribute(ADMIN_USER_SESSION);//获取登录后台的用户信息
//        return iAdminUserService.setAccountName(admin.getUserName(),password,passWord2);
////        return null;
//
//    }
//
//     //获取系统每天的收入
//    @RequestMapping(value = "getGainRecord")
//    public  JSONObject getGainRecord(@RequestParam String startTime,@RequestParam String endTime){
//
//            try {
//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
//                System.out.println("start" + startTime + "..............end" + endTime);
//                Date start = sdf.parse(startTime);
//                Date end = sdf.parse(endTime);
//
//                GainRecord gainRecord = iMoneyService.getGainRecordTime(new Timestamp(start.getTime()), new Timestamp(end.getTime()));
//                if (gainRecord != null){
//                    return JSONUtils.getRoot(0, "success", gainRecord);
//                }
//                return JSONUtils.getRoot(1, "fail", null);
//             } catch (ParseException e) {
//                 e.printStackTrace();
//                return JSONUtils.getRoot(1, "fail", "");
//        }
//    }
//
//    //获取系统所有的收入信息
//    @RequestMapping(value = "getGainRecordAll")
//    public JSONObject getGainRecordAll(@RequestParam int startPage) {
//        JSONObject jsonObject = iMoneyService.getGainRecordAll(startPage);
//        if (jsonObject != null)
//            return JSONUtils.getRoot(0, "success", jsonObject);
//        return JSONUtils.getRoot(1, "fail", null);
//
//    }
//
//
//
//    /**
//     * 获取用户详情
//     * @return
//     */
//    @RequestMapping(value = "getUserAll")
//    public JSONObject getUserAll(@RequestParam int  startPage,HttpSession session){
//
////        Admin admin= (Admin) session.getAttribute(ADMIN_USER_SESSION);//获取登录后台的用户信息
////        if(admin==null){
////            return JSONUtils.getRoot(1,"fail","用户为空，请重新登录");
////        }
//
//        JSONObject jsonObject=iAdminUserService.getUserByProxy(startPage,1);//系统后台查询所有用户
//        if(jsonObject!=null)
//            return JSONUtils.getRoot(0,"success",jsonObject);
//
//        return JSONUtils.getRoot(1,"fail",null);
//    }
//
//
//
//    /**
//     *  根据用户id,查询用户信息
//     * @param uid
//     * @return
//     */
//    @RequestMapping(value = "checkUserById")
//    public JSONObject checkUserById(@RequestParam long uid,HttpSession session){
//
//        Admin admin= (Admin) session.getAttribute(ADMIN_USER_SESSION);//获取登录后台的用户信息
//        if(admin==null){
//            return JSONUtils.getRoot(1,"fail","用户为空，请重新登录");
//        }
//       JSONObject jsonObject=iAdminUserService.checkUserById(uid,1);
////        JSONObject jsonObject=iAdminUserService.checkUserById(uid,admin.getUid());
//        if(jsonObject!=null)
//            return JSONUtils.getRoot(0,"success",jsonObject);
//
//        return JSONUtils.getRoot(1,"fail",null);
//    }
//
//
//    /**
//     * 用户提现的记录
//     * @param openId
//     * @return
//     */
//    @RequestMapping(value = "getCashRecord")
//    public JSONObject getCashRecord(@RequestParam String openId,@RequestParam int startPage){
//
//        if("".equals(openId) || startPage < 1){
//            return  JSONUtils.getRoot(1,"fail","参数有误");
//        }
//        JSONObject jsonObject=iMoneyService.getCashRecord(openId,startPage);
//        if(jsonObject==null) {
//            return JSONUtils.getRoot(1, "fail", "用户没有提现记录");
//        }
//        return JSONUtils.getRoot(0,"success",jsonObject);
//    }
//
//    /**
//     * 我的团队信息
//     * @param uid
//     * @return
//     */
//    @RequestMapping(value = "getProxyNum")
//    public JSONObject getProxyNum( @RequestParam long uid){
//
//        return JSONUtils.getRoot(0,"success",iFootUserService.getProxyNum(uid));
//    }
//
//    /**
//     * 获取用户佣金明细
//     * @param openId
//     * @return
//     */
//    @RequestMapping(value = "getCommRecord")
//    public JSONObject getCommRecord(@RequestParam String openId,@RequestParam int startPage){
//
//        if("".equals(openId) || startPage < 1){
//            return  JSONUtils.getRoot(1,"fail","参数有误");
//        }
//        JSONObject jsonObject=   iMoneyService.getCommRecord(openId,startPage);
//        if(jsonObject==null) {
//            return JSONUtils.getRoot(1, "fail", "该用户没有佣金记录");
//        }
//
//        return JSONUtils.getRoot(0,"success",jsonObject);
//    }
//
//    /**
//     * 获取用户得到股权的记录
//     * @param openId
//     * @return
//     */
//    @RequestMapping(value = "getShopSharesRecord")
//    public JSONObject getShopSharesRecordByUserId(@RequestParam  String openId,@RequestParam int startPage){
//
//        if("".equals(openId) || startPage < 1){
//            return  JSONUtils.getRoot(1,"fail","参数有误");
//        }
//       List list= iAdminUserService.getRwShopSharesRecord(openId,startPage);
//        JSONObject jsonObject=   new JSONObject();
//        jsonObject.put("value",list.get(0));
//        jsonObject.put("totalPage",list.get(1));
//        jsonObject.put("inPage",list.get(2));
//        if(jsonObject==null) {
//            return JSONUtils.getRoot(1, "fail", "该用户没有佣金记录");
//        }
//
//        return JSONUtils.getRoot(0,"success",jsonObject);
//    }
//
//    /**
//     * 充值记录
//     * @param openId
//     * @return
//     */
//    @RequestMapping(value = "getRechargeRecordMoney")
//    public JSONObject getRechargeRecordMoney(@RequestParam String openId,@RequestParam int startPage){
//
//        if( "".equals(openId) || startPage < 1){
//            return  JSONUtils.getRoot(1,"fail","参数有误");
//        }
//        JSONObject jsonObject=iMoneyService.getRechargeRecordMoney(openId,startPage);
//        if(jsonObject==null) {
//            return JSONUtils.getRoot(1, "fail", "该用户没有广告金充值记录");
//        }
//        return JSONUtils.getRoot(0,"success",jsonObject);
//
//    }
//
//
//
//    /**
//     * 关闭系统维护
//     * @return
//     */
//    @RequestMapping(value = "setClose")
//    @ResponseBody
//    public JSONObject setClose(){
//        boolean bool=  iAdminUserService.setSwitch(0L);
//        logger.info("setClose : "+bool);
//        if(bool)
//            return JSONUtils.getRoot(0,"success","设置关闭");
//        return JSONUtils.getRoot(1,"fail",null);
//
//    }
//
//    /**
//     * 开启系统维护
//     */
//    @RequestMapping(value = "setOpen")
//    @ResponseBody
//    public JSONObject setOpen(){
//        boolean bool=  iAdminUserService.setSwitch(1L);
//        logger.info("setOpen : "+bool);
//        if(bool)
//            return JSONUtils.getRoot(0,"success","设置打开");
//        return JSONUtils.getRoot(1,"fail",null);
//
//    }
//
//    /**
//     * 获取系统维护信息
//     * @return
//     */
//    @RequestMapping(value = "getSwitch")
//    public JSONObject getSwitch(){
//
//        Switch sw=  iAdminUserService.getSwitch();
//        if(sw!=null)
//            return JSONUtils.getRoot(0,"success",sw);
//        return JSONUtils.getRoot(1,"fail",null);
//
//    }
//
//    /**
//     * 设置佣金提现关闭
//     * @return
//     */
//    @RequestMapping(value = "setAliPayClose")
//    @ResponseBody
//    public JSONObject setAliPayClose(){
//        boolean bool=  iAdminUserService.setAliPaySwitch(0L);
//        logger.info("setAliPayClose : "+bool);
//        if(bool)
//            return JSONUtils.getRoot(0,"success","设置关闭");
//        return JSONUtils.getRoot(1,"fail",null);
//
//    }
//
//    /**
//     * 设置佣金提现打开
//     * @return
//     */
//    @RequestMapping(value = "setAliPayOpen")
//    @ResponseBody
//    public JSONObject setAliPayOpen(){
//        boolean bool=  iAdminUserService.setAliPaySwitch(1L);
//        logger.info("setAliPayOpen : "+bool);
//        if(bool)
//            return JSONUtils.getRoot(0,"success","设置打开");
//        return JSONUtils.getRoot(1,"fail",null);
//
//    }
//    //
//
//    /**
//     * 获取佣金提现的设置记录
//     * @return
//     */
//    @RequestMapping(value = "getAliPaySwitch")
//    public JSONObject getAliPaySwitch(){
//
//        AliPaySwitch sw=  iAdminUserService.getAliPaySwitch();
//        if(sw!=null)
//            return JSONUtils.getRoot(0,"success",sw);
//        return JSONUtils.getRoot(1,"fail",null);
//
//    }
//
//    //查询所有的商户号
//    @RequestMapping(value = "getPayBeanAll")
//    public JSONObject getPayBeanAll(HttpSession session){
//
//     List<PayBean>  list=  iAdminUserService.getPayBeanAll();
//        if(list!=null){
//            return JSONUtils.getRoot(0,"success",list);
//        }
//        return JSONUtils.getRoot(1,"fail",null);
//    }
//
//
//    //设置商户号禁用
//    @RequestMapping(value = "closePayBean")
//    public JSONObject closePayBean(@RequestParam long id){
//
//        PayBean payBean=   iAdminUserService.getPayBeanById(id);
//        payBean.setStatus("0");
//       Boolean bool= iAdminUserService.updatePayBean(payBean);
//       if(bool){
//           return JSONUtils.getRoot(0,"success","");
//       }
//        return JSONUtils.getRoot(1,"fail",null);
//    }
//
//    //设置商户号启用
//    @RequestMapping(value = "openPayBean")
//    public JSONObject openPayBean(@RequestParam long id){
//        try {
//        PayBean pay = iAdminUserService.getPayBeanByStatus("1");
//        boolean bool=false;
//        if(pay==null){
//            PayBean payBean = iAdminUserService.getPayBeanById(id);
//            payBean.setStatus("1");
//            bool = iAdminUserService.updatePayBean(payBean);
//            if (bool) {
//                return JSONUtils.getRoot(0, "success", "");
//            }
//        }
//        if(pay!=null){
//            pay.setStatus("0");
//            bool = iAdminUserService.updatePayBean(pay);
//                if (bool) {
//                    PayBean payBean = iAdminUserService.getPayBeanById(id);
//                    payBean.setStatus("1");
//                    bool = iAdminUserService.updatePayBean(payBean);
//                    if (bool) {
//                        return JSONUtils.getRoot(0, "success", "");
//                    }
//                }
//            }
//        }catch (NullPointerException e){
//          e.printStackTrace();
//        }
//        return JSONUtils.getRoot(1, "fail", null);
//    }
//
//
//    /**
//     * 添加支付商户号信息
//     * @param mchId
//     * @param mchKey
//     * @param wxAppid
//     * @param wxAppidKey
//     * @param stordId
//     * @param requestUrl
//     * @param remark
//     * @return
//     */
//    @RequestMapping(value = "savePayBean")
//    public JSONObject savePayBean(@RequestParam String mchId,@RequestParam String mchKey,@RequestParam String wxAppid,
//                                  @RequestParam String wxAppidKey,@RequestParam String stordId,@RequestParam  String requestUrl,@RequestParam String remark){
//
//        if(mchId==null || "".equals(mchId)  ||mchKey==null || "".equals(mchKey) ||wxAppid==null ||"".equals(wxAppid) ||wxAppidKey==null
//                || "".equals(wxAppidKey) ||stordId==null || "".equals(stordId) ||requestUrl==null || "".equals(requestUrl) ||remark==null || "".equals(remark) ){
//
//            return JSONUtils.getRoot(1,"fail","参数有误");
//        }
//
//
////    String mchId, String mchKey, String createTime, String status, String wxAppid, String wxAppidKey, String storeId, String requestUrl, String remark
//    PayBean payBean=new PayBean(mchId,mchKey,new Date().getTime()+"","0",wxAppid,wxAppidKey,stordId,requestUrl,remark);
//
//    PayBean pay=  iAdminUserService.savePayBean(payBean);
//    if(pay!=null){
//        return JSONUtils.getRoot(0,"success","");
//    }
//
//    return JSONUtils.getRoot(1,"fail",null);
//    }
//
//    //测试用户信息   查询用户信息不包含二维码
////    @RequestMapping(value = "findAllUser")
//    public JSONObject findAllUser(){
//      List<User> list=  iFootUserService.findAllUser();
//            if(list==null)
//        return null;
//
//        for (User user:list) {
//            logger.info("user:============"+user.toString());
//        }
//
//        return null;
//    }
//

}
